%% 
%function rbboxTest
 
% Generating example 2-D plot
figure
imshow(d0)
ginput(

figure
imshow(d1)
I1=imcrop(d1)
%%
%% Get Image
%   clc; close all; clear all;               %clean board
%   a = imread('smiley.jpg');                %read image
   [m n]= size(d0);                          %get no of rows and column of the image matrix
   imshow(d0)                                %display original image

% Crop Image Using Submatrix Operation
   [y,x] = ginput(2)                       %select two cursor points
   r1 = x(1,1); c1 = y(1,1)                %get first cursor point = first corner of the rectangle
   r2 = x(2,1); c2 = y(2,1)                %get second cursor point = second corner of the rectangle
   b = d0(r1:r2,c1:c2,:);                    %create the sub-matrix
   imshow(b)                                %display croped image
%%
clear v1
clear v2
v1=d0(r1:r2,c1:c2,:);
figure
imshow(v1)
v2=d1(r1:r2,c1:c2,:);
figure
imshow(v2)
v=xcorr2(v1,v2);%//,d1(r1:r2,c1:c2,:))
ret=find(v(1,:)==max(v(1,:)))
ret=ret/2;
figure
plot(v)

%figure
%imshow(I0)
%get(f)

%hfig = figure;
%hax = axes;
%xdata = 1:100;
%ydata = sin(xdata);
%hline = line(xdata,ydata,'Marker','o');
 
%set(f,'ButtonDownFcn',@OnClickAxes);
 
 
%end
%% 

 

 
